import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    adminname: sessionStorage.getItem('adminname'),
  },
  getters: {
  },
  mutations: {
    updateAdminname(state, adminname) {
      state.adminname = adminname;
      // 需要持久化存储,存入会话存储sessionStorage
      sessionStorage.setItem('adminname', adminname);
    },
    adminlogout(state, adminname) {
      state.adminname = ''
      sessionStorage.clear()//清空sessionStorage数据
    }
  },
  actions: {
  },
  modules: {
  }
})
